#include"StdAfx.h"
#include"Geometry.h"

void Geometry::CreateQuad(  XMFLOAT3 cenPos, float width, float height, BasicMesh& mesh )
{
	width /= 2;
	height /= 2;

	mesh.Vertices.resize( 4 );
	mesh.indices.resize( 6 );

	mesh.Vertices[0] = BasicVertex(
		cenPos.x - width, cenPos.y - height, cenPos.z,
		0.0f, 1.0f );

	mesh.Vertices[1] = BasicVertex(
		cenPos.x - width, cenPos.y + height, cenPos.z,
		0.0f, 0.0f );

	mesh.Vertices[2] = BasicVertex(
		cenPos.x + width, cenPos.y + height, cenPos.z,
		1.0f, 0.0f );

	mesh.Vertices[3] = BasicVertex(
		cenPos.x + width, cenPos.y - height, cenPos.z,
		1.0f, 1.0f );

	mesh.indices[0] = 0;
	mesh.indices[1] = 1;
	mesh.indices[2] = 2;

	mesh.indices[3] = 0;
	mesh.indices[4] = 2;
	mesh.indices[5] = 3;
}